import fetch from '@/utils/fetch'

export function getCurrentPubEnergyList(areaId, params) {
	return fetch({
		url: '/device/v1/mgt/public_energy/device_room',
	    method: 'get',
	    headers: {'x-area-id': areaId},
	    params
	})
}

export function getCurrentPubEnergyTotal(areaId, params) {
	return fetch({
		url: '/device/v1/mgt/public_energy/total',
	    method: 'get',
	    headers: {'x-area-id': areaId},
	    params
	})
}

export function getPubEnergyTrend(devRoomId, energyType) {
	return fetch({
		url: `/device/v1/mgt/public_energy/dev_room_id/${devRoomId}/type/${energyType}/trend`,
	    method: 'get'
	})
}

export const pubEnergyAlarmType = {
	0: "正常",
	1: "告警"
};

export const pubEnergyType = {
	1: "水",
	2: "电"
}

//拉取阈值
export function getThreshold(){
	return fetch({
		url:"/device/v1/mgt/public_energy/threshold",
		method:"get"
	})
}

//设置阈值
export function setThreshold(data){
	return fetch({
		url:"/device/v1/mgt/public_energy/threshold",
		method:"put",
		data
	})
}